<?php
namespace App\Core\Entity\Message;

/**
 * Response 失败实体对象
 */
class ResponseError implements ResponseInterface
{

    private $resp_msg = array(
        'msg_code' => 400,
        'msg_desc' => 'error',
        'msg_error' => array()
    );

    public function setMessageError(MessageError $error)
    {
        $this->resp_msg['msg_error'] = $error->toArray();
        return $this;
    }

    public function getMessageError()
    {
        return $this->resp_msg['msg_error'];
    }

    /**
     * 获取 Response 数组对象
     *
     * @return { resp_msg : { msg_code : 400, msg_desc : 'error', msg_error : { code : 4001, message : '', errors : [] } } }
     */
    public function getResponse()
    {
        return array(
            'resp_msg' => $this->resp_msg
        );
    }
}